﻿using Tfs.OnTheRoad.Commands;
using Tfs.OnTheRoad.Model;
namespace Tfs.OnTheRoad.ViewModel
{
    /// <summary>
    /// Queries List View Model
    /// </summary>
    public class QueriesListViewModel : BaseListViewModel<Query>
    {
        public NavigateToWorkItemsOverviewCommand NavigateToWorkItemsOverview
        {
            get;
            private set;
        }

        private Project _currentProject;

        public Project CurrentProject
        {
            get { return _currentProject; }
            set { _currentProject = value; }
        }

        public QueriesListViewModel(Model.Project project)
            : base()
        {
            NavigateToWorkItemsOverview = new NavigateToWorkItemsOverviewCommand();
            _currentProject = project;
            PageTitle = "Queries";
            OrderBy = "Name asc";
            Query = string.Format("Project eq '{0}'", project.Name);
        }

        public QueriesListViewModel(string path)
            : base(path)
        {
        }

        public override string GetNoResultsFoundMessage()
        {
            return "No queries were found.";
        }

        public override string GetEntityCollectionName()
        {
            return "Queries";
        }
    }
}
